/**
 * 专门为Count组件生成action对象
 */
import { INCREMENT, DECREMENT } from "./constant"

//同步action 值为Object
export const createIncrementAction= data=> ({type:INCREMENT,data})
export const createDecrementAction= data=> ({type:DECREMENT,data})

//异步action 值为Function,异步action中一般都会调用同步action
export const createIncrementAsyncAction = (data,time) =>{
    return (dispacth)=>{
        setTimeout(() => {
            dispacth(createIncrementAction(data))
        }, time);
    }
}